//统一管理项目接口的模块
import requests from "./request";

// Test1：分页获取用户列表  query请求
// /users/getUsersByPage   post    参数pageNum\pageSize
// reqgetUsersByPage(pageNum,pageSize);
export const reqgetUsersByPage = (pageNum, pageSize) => requests({ url: `/users/getUsersByPage?pageName=${pageNum}&pageSize=${pageSize}`, method: "post" });
//切记:当前函数执行需要把服务器返回结果返回

// Test2：用户注册  body请求
// /users/register   post    参数data
// reqRegister(params)
export const register = (data) => requests({ url: `/user/register`, data, method: "post" });

// 用户登录 query请求
// /users/login   post    参数uaccount/upwd
//reqLogin(uaccount,upwd)
export const login = (uaccount, upwd) => { return requests({ url: `/user/login?uaccount=${uaccount}&upwd=${upwd}`, method: "post" }) };
export const reqLogin = (uaccount, upwd) => requests({ url: `/users/login?uaccount=${uaccount}&upwd=${upwd}`, method: "post" });

//获取产品详情信息的接口，URL：/shoes/getShoesById
export const reqGoodsInfo = (sid) => { return requests({ url: `/detail?sid=${sid}`, method: "post" }) };
// export const reqGoodsInfo = (sid) => requests({ url: `/shoes/getShoesById`, sid, methods: 'post' });

//将产品添加到购物车中（获取更新某一个产品的个数）
export const reqAddOrUpdateShopCart = (sid, skuNum) => requests({ url: `/shopcart?sid=${sid}&skuNum=${skuNum}`, method: 'get' })

//获取购物车列表数据接口
export const reqCartList = (sid, skuNum) => requests({ url: `/cartList?sid=${sid}&skuNum=${skuNum}`, method: 'get' })
// 获取所有品牌信息 /brands/getAllBrands
export const reqgetAllBrands = () => requests({ url: `/brands/getAllBrands`, method: "post" })
// 根据条件获取商品(鞋子)推荐榜列表 /shoes/getShoesTop
export const reqgetShoesTop = (sgender, topWay) => requests({ url: `/shoes/getShoesTop?sgender=${sgender}&topWay=${topWay}`, method: "post" })
// 获取男鞋排行磅
export const reqgetManShoesTop = () => requests({ url: `/shoes/getManRange`, method: "post" })
// 获取女鞋排行榜
export const reqgetFemaleShoesTop = () => requests({ url: `/shoes/getFemaleRange`, method: "post" })


// 获取所有前台展现的类型列表 types/getAllTypesForView
export const reqgetAllTypes = () => requests({ url: `/types/getAllTypesForView`, method: "post" })
// 获取品牌信息
export const reqBrandList = () => {
    // return requests({ url: '/brands/getAllBrands', method: 'post' })
};

// 获取商品信息
export const reqSizeList = () => {
    return requests({ url: '/sizes/getAllSizes', method: 'post' })
};

// 获取颜色
export const reqColorList = () => {
    return requests({ url: '/color/getAllColor', method: 'post' })
};

// 获取鞋子类型
export const reqTypeList = () => {
    return requests({ url: '/types/getAllTypesForView', method: 'post' })
}

// 分页获取鞋子列表
export const reqShoesList = (params) => {
    return requests({ url: `/shoes/getShoesByPage`, method: 'post', data: params })
}
export const reqShoesListByBrands = (bid) => requests({ url: `/shoes/getShoesByBrands?bid=${bid}`, method: "post" });

//获取用户地址信息
export const reqAddressInfo = () => requests({ url: '/api/userInfos', method: 'post' });

//获取商品交易页面细信息
export const reqOrderInfo = () => requests({ url: '/api/shoesRanksInfos', method: 'post' });